package com.voicechat.firstmet.adapter;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.voicechat.firstmet.R;
import com.voicechat.firstmet.activity.PersonalHomepageActivity;
import com.voicechat.firstmet.activity.PostDetailsActivity;
import com.voicechat.firstmet.activity.WebPageActivity;
import com.voicechat.firstmet.base.BaseAdapter;
import com.voicechat.firstmet.bean.CommBean;
import com.voicechat.firstmet.bean.CoummunityNotice;
import com.voicechat.firstmet.bean.PostBean;
import com.voicechat.firstmet.client.OssConfig;
import com.voicechat.firstmet.fragment.CommunityFragment;
import com.voicechat.firstmet.net.HTTPAPI;
import com.voicechat.firstmet.net.service.CommunityService;
import com.voicechat.firstmet.utils.GlideLoadUtils;
import com.voicechat.firstmet.utils.PhoneUtils;
import com.voicechat.firstmet.utils.Utils;
import com.voicechat.firstmet.view.AutoVerticalScrollTextView;
import com.voicechat.firstmet.view.CircleImageView;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import library.banner.layoutmanager.BannerLayout;
import library.banner.layoutmanager.WebBannerAdapter;

/**
 * @ProjectName: FirstMet
 * @Package: com.voicechat.firstmet.adapter
 * @ClassName: 社区listAdapter
 * @Description: java类作用描述
 * @Author: ljp
 * @CreateDate: 2018/9/4 14:11
 * @Version: 1.0
 */
public class CommunityAdapter extends BaseAdapter<PostBean.PageBean.ListBean> {
    private Context context;
    private List<PostBean.PageBean.ListBean> tlist;
    private int SIGN_LAYOUT = -1;
    private int PICTURE_LAYOUT = 2;
    private int COMM_LAYOUT = 3;
    int number = 0;
    Thread thread;
    private String TAG = "CommunityAdapter";
    public ItemSetClick itemSetClick;
    private int position1;
    AnchorIconAdapter anchorIconAdapter;
    private List<CommBean.MapBean> postLists;
    private List<CoummunityNotice.PageBean.ListBean> notices;
    private String flag;

    /**
     * @param context activity_imessage
     * @param tlist   集合
     * @param mLayout 主布局
     */
    public CommunityAdapter(Context context, List<PostBean.PageBean.ListBean> tlist, int mLayout, String flag) {
        super(context, tlist, mLayout);
        this.tlist = tlist;
        this.context = context;
        this.notices = new ArrayList<>();
        this.postLists = new ArrayList<>();
        this.flag = flag;

    }

    public void setPostList(List<CommBean.MapBean> postLists) {
        this.postLists = postLists;
        notifyDataSetChanged();
    }

    public List<PostBean.PageBean.ListBean> getTlist() {
        return tlist;
    }

    public void setNoticeList(List<CoummunityNotice.PageBean.ListBean> notices) {
        this.notices = notices;
        notifyDataSetChanged();
    }

    public void setItemSetClick(ItemSetClick itemSetClick) {
        this.itemSetClick = itemSetClick;
    }


    @Override
    protected RecyclerView.ViewHolder getHeaderViewHolder(View view) {
        HeadViewHolder headViewHolder = new HeadViewHolder(view);
        return headViewHolder;
    }

    @Override
    protected RecyclerView.ViewHolder getItemViewHolder(View view) {
        ViewHolder1 viewHolder1 = new ViewHolder1(view);
        return viewHolder1;
    }


    @Override
    protected RecyclerView.ViewHolder getFooterViewHolder(View view) {
        return null;
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
        position1 = position;
        if (tlist.size() != 0) {
            //头布局
            if (viewHolder instanceof HeadViewHolder) {
                if (postLists.size() != 0) {
                    CommBean.MapBean mapBean = postLists.get(0);
                    HeadViewHolder headViewHolder = (HeadViewHolder) viewHolder;
                    //banneer
                    WebBannerAdapter webBannerAdapter = new WebBannerAdapter(context, mapBean.getTimeInterval());
                    webBannerAdapter.setOnBannerItemClickListener(new BannerLayout.OnBannerItemClickListener() {
                        @Override
                        public void onItemClick(int position) {
                            CommBean.MapBean.TimeIntervalBean timeIntervalBean = mapBean.getTimeInterval().get(position);
                            Intent intent = null;
                            Uri uri = null;
                            switch (timeIntervalBean.getRemarks()) {//h5:"1"  金币充值："2"  会员购买："3"  热门帖子："4"
                                case "1":
                                    intent = new Intent(context, WebPageActivity.class);
                                    intent.putExtra("url", timeIntervalBean.getH5Url());
                                    intent.putExtra("userId", CommunityFragment.mySeleInfo.getId());
                                    intent.putExtra("title", timeIntervalBean.getTitle());
                                    context.startActivity(intent);
                                    break;
                                case "2":
                                    uri = Uri.parse(HTTPAPI.URL_RECHARGE + "id=" + CommunityFragment.mySeleInfo.getNumber());
                                    intent = new Intent(Intent.ACTION_VIEW, uri);
                                    context.startActivity(intent);
                                    break;
                                case "3":
                                    uri = Uri.parse(HTTPAPI.URL_MEMBER + "id=" + CommunityFragment.mySeleInfo.getNumber());
                                    intent = new Intent(Intent.ACTION_VIEW, uri);
                                    context.startActivity(intent);
                                    break;
                                case "4":
                                    setHttpPost(timeIntervalBean.getHotId());
                                    break;
                            }
                        }
                    });
                    headViewHolder.bannerList.setAdapter(webBannerAdapter);
                    headViewHolder.bannerList.setCenterScale(1.0f);
                    headViewHolder.bannerList.setShowIndicator(false);
                    //广告位
                    String url = mapBean.getAdvertisement().get(0).getUrl();
                    GlideLoadUtils.getInstance().glideLoad(context, OssConfig.OSS_HTTP + url,
                            headViewHolder.imagePicture);
                    headViewHolder.imagePicture.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            Intent intent = new Intent(context, WebPageActivity.class);
                            intent.putExtra("url", mapBean.getAdvertisement().get(0).getH5Url());
                            intent.putExtra("userId", CommunityFragment.mySeleInfo.getId());
                            intent.putExtra("title", mapBean.getAdvertisement().get(0).getTitle());
                            context.startActivity(intent);
                        }
                    });
                    if (notices.size() != 0) {//公告
                        setScrollText(headViewHolder.autoTextNotice);
                    }
                    headViewHolder.autoTextNotice.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            itemSetClick.setNoticeClick(v, notices);
                        }
                    });
                    anchorIconAdapter = new AnchorIconAdapter(context, mapBean.getRealTime(), R.layout.item_picure);
                    headViewHolder.recycler.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false));
                    headViewHolder.recycler.setAdapter(anchorIconAdapter);
                    anchorIconAdapter.setOnClick(new AnchorIconAdapter.OnClick() {
                        @Override
                        public void onSetPictureClick(View view, int position) {
                            List<CommBean.MapBean.RealTimeBean> realTime = mapBean.getRealTime();
                            Intent intent = new Intent(context, PersonalHomepageActivity.class);
                            intent.putExtra("anchorId", realTime.get(position).getUserId());
                            context.startActivity(intent);
                        }
                    });
                    if (mapBean.getDynamic() != null && mapBean.getDynamic().size() != 0) {
                        CommBean.MapBean.DynamicBean dynamic = mapBean.getDynamic().get(0);
                        if (!TextUtils.isEmpty(dynamic.getBirthday())) {
                            String substring = dynamic.getBirthday().substring(0, 4);
                            String time = Utils.getStringTime(new Date());
                            int age = (Integer.parseInt(time)) - (Integer.parseInt(substring));
                            headViewHolder.tvAge.setText(age + "");
                        }
                        headViewHolder.imageIcon.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                itemSetClick.setIconClick(v, dynamic);
                            }
                        });
                        Log.i(TAG, "onBindViewHolder: -----" + dynamic.toString());
                        //setImage(dynamic.getAvatarUrl(), headViewHolder.imageIcon);//下载头像
                        if (!TextUtils.isEmpty(dynamic.getAvatarUrl())) {
                            if (!dynamic.getAvatarUrl().equals(headViewHolder.imageIcon.getTag(R.id.image_icon))) {
                                // 加载图片
                                headViewHolder.imageIcon.setTag(R.id.image_icon, dynamic.getAvatarUrl());
                                GlideLoadUtils.getInstance().glideLoad(context, OssConfig.OSS_HTTP + dynamic.getAvatarUrl(),
                                        headViewHolder.imageIcon);
                                //setImage(dynamic.getAvatarUrl(), headViewHolder.imageIcon);
                            }
                        }
                        headViewHolder.tvTitle.setText(dynamic.getMdTitle());
                        if (!TextUtils.isEmpty(dynamic.getVoiceUrl())) {
                            headViewHolder.linearSendVoice.setVisibility(View.VISIBLE);
                            headViewHolder.tvContent.setVisibility(View.GONE);
                            headViewHolder.tvVoiceTime.setText(dynamic.getDuration() + "s");
                        } else {
                            headViewHolder.linearSendVoice.setVisibility(View.GONE);
                            headViewHolder.tvContent.setVisibility(View.VISIBLE);
                            headViewHolder.tvContent.setText(dynamic.getContent());
                        }
                        headViewHolder.tvCommNumber.setText(dynamic.getDiscussCount() + "");
                        headViewHolder.tvLikeNumber.setText(dynamic.getFabulousCount() + "");
                        headViewHolder.tvDate.setText(dynamic.getMdUpdateDate());
                        if (TextUtils.isEmpty(dynamic.getUrl())) {//判断是否有图片，如果没有图片，不显示图片
                            headViewHolder.circlePicture.setVisibility(View.GONE);
                        } else {
                            headViewHolder.circlePicture.setVisibility(View.VISIBLE);
                        }
                        if (TextUtils.isEmpty(dynamic.getUrl())) {
                            headViewHolder.circlePicture.setVisibility(View.GONE);
                        } else {
                            String[] strings = Utils.spitPictureUrl(dynamic.getUrl());
                            if (!strings[0].equals(headViewHolder.circlePicture.getTag(R.id.circle_picture))) {
                                // 加载图片
                                headViewHolder.circlePicture.setTag(R.id.circle_picture, strings[0]);
                                GlideLoadUtils.getInstance().glideLoad(context, OssConfig.OSS_HTTP + strings[0],
                                        headViewHolder.circlePicture);
                            }
                        }
                        if (dynamic.getGender() == 1) {//判断性别  1男 2女
                            headViewHolder.imageSex.setImageResource(R.mipmap.boy);
                            headViewHolder.linearSexAge.setBackgroundResource(R.mipmap.sex_blue);
                        } else if (dynamic.getGender() == 2) {
                            headViewHolder.imageSex.setImageResource(R.mipmap.girl);
                            headViewHolder.linearSexAge.setBackgroundResource(R.mipmap.sex_red);
                        }
                        headViewHolder.linearLike.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                itemSetClick.setLikeClick(v, dynamic);
                            }
                        });
                        //Log.i(TAG, "onBindViewHolder: ----dynamic.getIsFabulous()-----"+dynamic.getIsFabulous());
                        if (!TextUtils.isEmpty(dynamic.getIsFabulous())) {
                            if (dynamic.getIsFabulous().equals("0")) {//我是否点赞  1 已经点赞   0 未点赞
                                headViewHolder.imageLike.setImageResource(R.mipmap.unlike);
                            } else {
                                headViewHolder.imageLike.setImageResource(R.mipmap.like);
                            }
                        }
                        if (!TextUtils.isEmpty(dynamic.getuType())) {
                            if (dynamic.getuType().equals("2")) {//判断是否是主播
                                headViewHolder.imageAnchor.setVisibility(View.VISIBLE);
                            } else {
                                headViewHolder.imageAnchor.setVisibility(View.GONE);
                            }
                        }
                        if (!TextUtils.isEmpty(dynamic.getvType())) {
                            if (dynamic.getvType().equals("1")) {//判断是vip等级 1 月 2 年 0 不是会员
                                headViewHolder.imageVip.setVisibility(View.VISIBLE);
                                headViewHolder.imageVip.setImageResource(R.mipmap.vip_month);
                                headViewHolder.tvNikeName.setTextColor(context.getResources().getColor(R.color.colorFF3B5E));
                            } else if (dynamic.getvType().equals("2")) {
                                headViewHolder.imageVip.setVisibility(View.VISIBLE);
                                headViewHolder.imageVip.setImageResource(R.mipmap.vip_year);
                                headViewHolder.tvNikeName.setTextColor(context.getResources().getColor(R.color.colorFF3B5E));
                            } else {
                                headViewHolder.imageVip.setVisibility(View.GONE);
                                headViewHolder.tvNikeName.setTextColor(context.getResources().getColor(R.color.color333333));
                            }
                        }
                        if (!TextUtils.isEmpty(dynamic.getMdUpdateDate())) {
                            String standardDate = Utils.getStandardDate(dynamic.getMdUpdateDate());//将返回时间转换为多久前
                            headViewHolder.tvDate.setText(standardDate);
                        }
                        headViewHolder.tvNikeName.setText(dynamic.getNickName());
                        headViewHolder.linearHot.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                itemSetClick.setItemClick(headViewHolder.itemView, dynamic);
                            }
                        });
                        Log.i(TAG, "onBindViewHolder: --------" + dynamic.toString());
                        headViewHolder.linearSendVoice.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                itemSetClick.setPlayVoiceClick(dynamic, headViewHolder.imageSendVoiceIcon, 0);
                            }
                        });
                    }
                }

            } else if (viewHolder instanceof ViewHolder1) { //普通布局
                if (postLists.size() != 0 && position == 0) {
                    return;
                }
                ViewHolder1 viewHolder1 = (ViewHolder1) viewHolder;
                if (postLists.size() != 0) {
                    position = position - 1;
                }
                if (position == 0 && !flag.equals("person")) {
                    viewHolder1.tvSign.setVisibility(View.VISIBLE);
                } else {
                    viewHolder1.tvSign.setVisibility(View.GONE);
                }
                PostBean.PageBean.ListBean listBean = tlist.get(position);
                Log.i(TAG, "onBindViewHolder: ----------" + listBean.toString());
                if (TextUtils.isEmpty(listBean.getUrl())) {
                    viewHolder1.circlePicture.setVisibility(View.GONE);
                } else {
                    String[] strings = Utils.spitPictureUrl(listBean.getUrl());
                    // Log.i(TAG, "onBindViewHolder: "+strings.length);
                    //setImage(strings[0],viewHolder1.circlePicture);
                    if (!strings[0].equals(viewHolder1.circlePicture.getTag(R.id.circle_picture))) {
                        // 加载图片
                        viewHolder1.circlePicture.setTag(R.id.circle_picture, strings[0]);
                        GlideLoadUtils.getInstance().glideLoad(context, OssConfig.OSS_HTTP + strings[0],
                                viewHolder1.circlePicture);
                    }
                }
                //setImage(listBean.getAvatarUrl(), viewHolder1.imageIcon);//下载头像
                if(!TextUtils.isEmpty(listBean.getAvatarUrl())) {
                    if (!listBean.getAvatarUrl().equals(viewHolder1.imageIcon.getTag(R.id.image_icon))) {
                        // 加载图片
                        viewHolder1.imageIcon.setTag(R.id.image_icon, listBean.getAvatarUrl());
                        GlideLoadUtils.getInstance().glideLoad(context, OssConfig.OSS_HTTP + listBean.getAvatarUrl(),
                                viewHolder1.imageIcon);
                        //setImage(listBean.getAvatarUrl(), viewHolder1.imageIcon);
                    }
                }
                viewHolder1.tvTitle.setText(listBean.getMdTitle());
                if (!TextUtils.isEmpty(listBean.getVoiceUrl())) {
                    viewHolder1.tvContent.setVisibility(View.GONE);
                    viewHolder1.linearSendVoice.setVisibility(View.VISIBLE);
                    viewHolder1.tvVoiceTime.setText(listBean.getDuration() + "s");
                } else {
                    viewHolder1.linearSendVoice.setVisibility(View.GONE);
                    viewHolder1.tvContent.setVisibility(View.VISIBLE);
                    viewHolder1.tvContent.setText(listBean.getContent());
                }
                viewHolder1.tvCommNumber.setText(listBean.getDiscussCount() + "");
                viewHolder1.tvLikeNumber.setText(listBean.getFabulousCount() + "");
                if (!TextUtils.isEmpty(listBean.getMdUpdateDate())) {
                    String standardDate = Utils.getStandardDate(listBean.getMdUpdateDate());//将返回时间转换为多久前
                    viewHolder1.tvDate.setText(standardDate);
                }
                if (!TextUtils.isEmpty(listBean.getuType()) && listBean.getuType().equals("2")) {//判断是否是主播
                    viewHolder1.imageIsanchor.setVisibility(View.VISIBLE);
                } else {
                    viewHolder1.imageIsanchor.setVisibility(View.GONE);
                }
                if (TextUtils.isEmpty(listBean.getUrl())) {//判断是否有图片，如果没有图片，不显示图片
                    viewHolder1.circlePicture.setVisibility(View.GONE);
                } else {
                    viewHolder1.circlePicture.setVisibility(View.VISIBLE);
                }
                //Log.i(TAG, "onBindViewHolder: ----position-----"+position+"--listBean.getIsFabulous()--"+listBean.getIsFabulous());
                if (listBean.getIsFabulous().equals("0")) {//我是否点赞  0 未点赞   1 点赞
                    viewHolder1.imageLike.setImageResource(R.mipmap.unlike);
                } else {
                    viewHolder1.imageLike.setImageResource(R.mipmap.like);
                }
                if (!TextUtils.isEmpty(listBean.getvType()) &&
                        listBean.getvType().equals("1")) {//判断是vip等级 1 月 2 年 0 不是会员
                    viewHolder1.imageVip.setVisibility(View.VISIBLE);
                    viewHolder1.imageVip.setImageResource(R.mipmap.vip_month);
                    viewHolder1.tvNikeName.setTextColor(context.getResources().getColor(R.color.colorFF3B5E));
                } else if (listBean.getvType().equals("2")) {
                    viewHolder1.imageVip.setVisibility(View.VISIBLE);
                    viewHolder1.imageVip.setImageResource(R.mipmap.vip_year);
                    viewHolder1.tvNikeName.setTextColor(context.getResources().getColor(R.color.colorFF3B5E));
                } else {
                    viewHolder1.imageVip.setVisibility(View.GONE);
                    viewHolder1.tvNikeName.setTextColor(context.getResources().getColor(R.color.color333333));
                }
                if (listBean.getGender() == 1) {//判断性别  1男 2女
                    viewHolder1.imageSex.setImageResource(R.mipmap.boy);
                    viewHolder1.linearSexAge.setBackgroundResource(R.mipmap.sex_blue);
                } else if (listBean.getGender() == 2) {
                    viewHolder1.imageSex.setImageResource(R.mipmap.girl);
                    viewHolder1.linearSexAge.setBackgroundResource(R.mipmap.sex_red);
                }
                if (!TextUtils.isEmpty(listBean.getBirthday())) {
                    String substring = listBean.getBirthday().substring(0, 4);
                    String time = Utils.getStringTime(new Date());
                    int age = (Integer.parseInt(time)) - (Integer.parseInt(substring));
                    viewHolder1.tvAge.setText(age + "");
                }
                viewHolder1.itemView.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        itemSetClick.setItemClick(viewHolder1.itemView, listBean);
                    }
                });
                viewHolder1.tvNikeName.setText(listBean.getNickName());
                viewHolder1.linearLike.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        itemSetClick.setLikeClick(v, listBean);
                    }
                });
                viewHolder1.imageIcon.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        itemSetClick.setIconClick(v, listBean);
                    }
                });
                int finalPosition = position;
                viewHolder1.linearSendVoice.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        itemSetClick.setPlayVoiceClick(listBean, viewHolder1.imageSendVoiceIcon, finalPosition);
                    }
                });
            }
        }
    }

    /**
     * @return
     * @method
     * @description 查询帖子详情
     * @date: 2018/12/14 14:29
     * @author: ljp
     */
    private void setHttpPost(String hotId) {
        CommunityService.selectDynamic(CommunityFragment.mySeleInfo.getToken(),
                PhoneUtils.getDeviceInfo(context), CommunityFragment.mySeleInfo.getId(), hotId).subscribe(postBean -> {
            Log.i(TAG, "setHttpPost: -----------" + postBean.getCode());
            Log.i(TAG, "setHttpPost: -----------" + postBean.toString());
            if (postBean.getCode() == HTTPAPI.RETURN_CODE_TYPE.RETRUN_SUCCESS) {
                PostBean.ObjectBean objectBean = postBean.getObjectBean();
                PostBean.PageBean.ListBean listBean = new PostBean.PageBean.ListBean(objectBean.getId(), objectBean.isNewRecord(),
                        objectBean.getMdTitle(), objectBean.getContent(), objectBean.getMdUpdateDate(), objectBean.getUserId(),
                        objectBean.getAvatarUrl(), objectBean.getNickName(), objectBean.getGender(), objectBean.getBirthday(),
                        objectBean.getFabulousCount(), objectBean.getDiscussCount(), objectBean.getIsFabulous(), objectBean.getvType(),
                        objectBean.getuType(), objectBean.getUrl(), objectBean.getWarrant(), objectBean.getIsFollow(), objectBean.getVoiceUrl(), objectBean.getDuration());
                Intent intent = new Intent(context, PostDetailsActivity.class);
                intent.putExtra("listBean", listBean);
                context.startActivity(intent);
            }
        }, throwable -> {
            Utils.toast_MakeText(context.getResources().getString(R.string.net_error), context);
        });


    }
    /**
     * 公告
     */
    public void setScrollText(AutoVerticalScrollTextView newHomeNotice) {
        newHomeNotice.setText(notices.get(0).getTitle());
        Handler handler = new Handler() {
            @Override
            public void handleMessage(Message msg) {
                if (msg.what == 199)
                    if (notices.size() != 0) {
                        newHomeNotice.next();
                        number++;
                        newHomeNotice.setText(notices.get(number % notices.size()).getTitle());
                    }
            }
        };
        thread = new Thread() {
            @Override
            public void run() {
                while (true) {
                    SystemClock.sleep(5000);
                    handler.sendEmptyMessage(199);
                }
            }
        };
        thread.start();
    }

    /**
     * 头布局
     */
    class HeadViewHolder extends BaseViewHolder {
        @BindView(R.id.banner_list)
        BannerLayout bannerList;
        @BindView(R.id.auto_text_notice)
        AutoVerticalScrollTextView autoTextNotice;
        @BindView(R.id.linear_notice)
        LinearLayout linearNotice;
        @BindView(R.id.recycler_)
        RecyclerView recycler;
        @BindView(R.id.tv_sign)
        TextView tvSign;
        @BindView(R.id.circle_picture)
        CircleImageView circlePicture;
        @BindView(R.id.tv_title)
        TextView tvTitle;
        @BindView(R.id.tv_content)
        TextView tvContent;
        @BindView(R.id.image_icon)
        CircleImageView imageIcon;
        @BindView(R.id.tv_nike_name)
        TextView tvNikeName;
        @BindView(R.id.tv_comm_number)
        TextView tvCommNumber;
        @BindView(R.id.tv_like_number)
        TextView tvLikeNumber;
        @BindView(R.id.tv_date)
        TextView tvDate;
        @BindView(R.id.image_picture)
        CircleImageView imagePicture;
        @BindView(R.id.image_isanchor)
        ImageView imageAnchor;
        @BindView(R.id.image_vip)
        ImageView imageVip;
        @BindView(R.id.image_like)
        ImageView imageLike;
        @BindView(R.id.linear_like)
        LinearLayout linearLike;
        @BindView(R.id.image_sex)
        ImageView imageSex;
        @BindView(R.id.tv_age)
        TextView tvAge;
        @BindView(R.id.linear_sex_age)
        LinearLayout linearSexAge;
        @BindView(R.id.relative_hot)
        RelativeLayout relativeLayout;
        @BindView(R.id.image_send_voice_icon)
        ImageView imageSendVoiceIcon;
        @BindView(R.id.tv_voice_time)
        TextView tvVoiceTime;
        @BindView(R.id.linear_send_voice)
        RelativeLayout linearSendVoice;
        View view;
        @BindView(R.id.linear_hot)
        LinearLayout linearHot;

        public HeadViewHolder(View itemView) {
            super(itemView);
            view = itemView;
            ButterKnife.bind(this, itemView);
        }
    }

    /**
     * 布局1
     */
    class ViewHolder1 extends BaseViewHolder {
        @BindView(R.id.tv_sign)
        TextView tvSign;
        @BindView(R.id.circle_picture)
        CircleImageView circlePicture;
        @BindView(R.id.tv_title)
        TextView tvTitle;
        @BindView(R.id.tv_content)
        TextView tvContent;
        @BindView(R.id.image_icon)
        CircleImageView imageIcon;
        @BindView(R.id.tv_nike_name)
        TextView tvNikeName;
        @BindView(R.id.tv_comm_number)
        TextView tvCommNumber;
        @BindView(R.id.tv_like_number)
        TextView tvLikeNumber;
        @BindView(R.id.tv_date)
        TextView tvDate;
        @BindView(R.id.image_isanchor)
        ImageView imageIsanchor;
        @BindView(R.id.image_vip)
        ImageView imageVip;
        @BindView(R.id.image_like)
        ImageView imageLike;
        @BindView(R.id.linear_like)
        LinearLayout linearLike;
        @BindView(R.id.image_sex)
        ImageView imageSex;
        @BindView(R.id.tv_age)
        TextView tvAge;
        @BindView(R.id.linear_sex_age)
        LinearLayout linearSexAge;
        View itemView;
        @BindView(R.id.image_send_voice_icon)
        ImageView imageSendVoiceIcon;
        @BindView(R.id.tv_voice_time)
        TextView tvVoiceTime;
        @BindView(R.id.linear_send_voice)
        RelativeLayout linearSendVoice;

        public ViewHolder1(View itemView) {
            super(itemView);
            this.itemView = itemView;
            ButterKnife.bind(this, itemView);

        }
    }

    public interface ItemSetClick {
        void setIconClick(View view, PostBean.PageBean.ListBean listBean);

        void setIconClick(View view, CommBean.MapBean.DynamicBean dynamic);

        void setItemClick(View view, PostBean.PageBean.ListBean listBean);

        void setLikeClick(View view, CommBean.MapBean.DynamicBean dynamic);

        void setLikeClick(View view, PostBean.PageBean.ListBean listBean);

        void setItemClick(View view, CommBean.MapBean.DynamicBean dynamic);

        void setNoticeClick(View view, List<CoummunityNotice.PageBean.ListBean> notices);

        void setPlayVoiceClick(PostBean.PageBean.ListBean listBean, View view, int position);

        void setPlayVoiceClick(CommBean.MapBean.DynamicBean dynamic, View view, int position);
    }
}
